﻿using CommonModel.Field;
using System.Collections.Generic;
using static CommonModel.Model.DataTypeDll;

namespace GXRTBTC.PublicClassLibrary.Field
{
    /// <summary>
    /// 字段属性，有子节点的
    /// </summary>
    public class SchemaDictionary
    {
        /// <summary>
        /// 配置ID
        /// </summary>
        public int id { get; set; }
        /// <summary>
        /// 字段名称
        /// </summary>
        public string name { get; set; }
        /// <summary>
        /// 字段类型
        /// </summary>
        public DataType type { get; set; }
        /// <summary>
        /// 字段值
        /// </summary>
        public string value { get; set; }
        /// <summary>
        /// 排序
        /// </summary>
        public int index { get; set; }
        /// <summary>
        /// 类型所占字节数, 即该数据类型占几个字节
        /// </summary>
        public int size { get; set; }
        /// <summary>
        /// 设备类型
        /// </summary>
        public string deviceType { get; set; }
        /// <summary>
        /// 是否告警
        /// </summary>
        //public bool isAlarm { get; set; }
        /// <summary>
        /// 告警值
        /// </summary>
        //public string alarmValue { get; set; }
        /// <summary>
        /// 告警名称
        /// </summary>
        //public string alarmName { get; set; }
        /// <summary>
        /// 因为存在部分结构体是在实际的数据字段中指出有多少个
        /// 所以结构体个数给字符串, 给数字无法在解析规则文件时生成对象
        /// </summary>
        public string loop { get; set; }
        /// <summary>
        /// 编码
        /// </summary>
        public string code { get; set; }
        /// <summary>
        /// 是否保存
        /// </summary>
        public string isSave { get; set; }
        /// <summary>
        /// 层级
        /// </summary>
        public int layer { get; set; }
        /// <summary>
        /// 是否中间节点，是则有子节点
        /// 此时fieldDictionary有值
        /// </summary>
        public bool isNode { get; set; } = false;
        /// <summary>
        /// 有子节点的
        /// 保存子节点信息
        /// </summary>
        public Dictionary<int, SchemaDictionary> fieldDictionary { get; set; }
        /// <summary>
        /// 备注说明
        /// </summary>
        public string memo { get; set; } = "";
    }
}
